package edu.vt.sdm.tcga.filenavigator.view;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

import edu.vt.sdm.tcga.filenavigator.model.FileBean;
import edu.vt.sdm.tcga.filenavigator.model.NavigatorRoot;

public class TreeContentProvider implements ITreeContentProvider{


	@Override
	public Object[] getChildren(Object parentElement) {
		FileBean parent = (FileBean)parentElement;
//		System.out.println("TreeContentProvider.getChildren(" + parent.toString() + ")");
		return parent.getChildren();
	}

	@Override
	public Object getParent(Object element) {
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		FileBean bean = (FileBean)element;
//		System.out.println("TreeContentProvider.hasChildren(" + bean.hasChildren() + ")");
		return bean.hasChildren();
	}

	@Override
	public Object[] getElements(Object inputElement) {
		NavigatorRoot root = ((NavigatorRoot)inputElement);
		return root.getParentBeans();
	}

	@Override
	public void dispose() {
	}

	@Override
	public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
	}
}
